home *** CD-ROM | disk | FTP | other *** search
- DrawFile 1.4
- ======== ===
-
- This directory contains the specification for the DrawFile module (below),
- and headers for C and assembler, and a veneer library, all in OSLib format.
- The OSLib header file also contains all the structure definitions you might
- need to manipulate draw files in C.
-
- DrawFile is a module that renders draw files. It provides three SWI's, two
- service calls and a *command. Version numbers in [square brackets] are the
- earliest version to implement a given feature.
-
- SWI's
- =====
-
- DrawFile_Render
- ---------------
-
- Entry:
-
- R0 = flags:
- bit 0: render bounding boxes (as dotted red rectangles)
- bit 1: do not render the objects themselves
- bit 2: if set, R5 is used as the flatness parameter [1.3]
- R1 -> draw file data
- R2 = size of draw file in bytes
- R3 -> transformation matrix
- = 0 <=> use identity
- R4 -> clipping rectangle in O S units
- = 0 <=> no clipping rectangle set up
- R5 = flatness with which to render lines (if bit 2 of R0 set) [1.3]
-
- Exit:
-
- All registers preserved
-
- Use:
-
- This SWI renders a draw file at a given screen position where that
- position is defined as screen position 0, 0 with the x- and y-translations
- as specified in the transformation matrix. Hence to render a non-rotated 1:1
- draw file at (x, y) (screen coordinates in O S units) the transformation
- matrix is
-
- (1 << 16 0)
- ( 0 1 << 16)
- ( 256*x 256*y).
-
- The effects of calling the module with the matrix not of the form
-
- (f 0)
- (0 f)
- (x y)
-
- (which is a translation and a magnification) should not be relied on. If R3
- = 0, then unit transformation matrix is assumed (i e, the draw file is
- rendered with its bottom left corner at screen coordinates (0, 0)).
-
- The clipping rectangle is typically a redraw rectangle returned by the
- Wimp on a redraw window request. If R4 = 0, then the whole draw file is
- rendered. If non-zero, only objects which intersect the clipping rectangle
- are rendered.
-
- DrawFile_BBox
- -------------
-
- Entry:
-
- R0 = flags (must be 0)
- R1 -> draw file data
- R2 = size of draw file in bytes
- R3 -> transformation matrix
- = 0 <=> use identity
- R4 -> 4-word buffer to hold the bounding box of the draw file
- (x0, y0, x1, y1) in draw units
-
- Exit:
-
- All registers preserved. Buffer pointed at by R4 holds the bounding box
- of the draw file (x0, y0, x1, y1) in draw units.
-
- Use:
-
- This SWI is used to determine the bounding box (in draw units) of the
- given draw file, as if it were plotted with the transformation given.
-
- DrawFile_DeclareFonts
- ---------------------
-
- Entry:
-
- R0 = flags
- bit 0: do not download font (passed to PDriver_DeclareFont)
- R1 -> draw file data
- R2 = size of draw file in bytes
-
- Exit:
-
- All registers preserved. All fonts used by the document have been
- declared.
-
- Use:
-
- If a printer requires font declarations, this SWI must be called for each
- drawfile to be printed, between the calls to PDriver_SelectJob and
- PDriver_DrawPage.
-
- All fonts are declared as "kerned," since this includes the non-kerned
- case.
-
- Service calls
- ======= =====
-
- Service_DrawObjectRender (SWI 0x30) [1.4]
-
- Entry:
-
- R0 = object type
- R1 = 0x45540 (reason code)
- R2 -> render state block
-
- Exit:
-
- R1 = 0 if claimed, otherwise preserved
-
- Use:
-
- This service call is made when SWI DrawFile_Render encounters an object
- with a type it doesn't recognise, so that another module may render it
- instead. It should be claimed if the object type is recognised. If an error
- is encountered during rendering, an OS_Error pointer may be put in the
- DrawFile_RenderState structure, but this should only be done if the pointer
- currently there is 0. The DrawFile module will attempt to render all objects,
- but only return the first error found. The block is defined as
-
- +0 -> object to be rendered
- +4 -> diagram
- +8 -> font table object, or 0 if none found yet
- +12 = flags, as passed to DrawFile_Render
- +16 => transformation matrix
- +20 -> clipping rectangle, or 0
- +24 = flatness
- +28 -> error block, or 0
-
- Service_DrawObjectDeclareFonts (SWI 0x30) [1.4]
-
- Entry:
-
- R0 = object type
- R1 = 0x45541 (reason code)
- R2 -> declare font dtate block
-
- Exit:
-
- R1 = 0 if claimed, otherwise preserved
-
- Use:
-
- This service call is made when DrawFile_DeclareFonts encounters an object
- with a type it doesn't recognise, so another module may declare its fonts
- instead. It should be claimed if the object type is recognised. If an error
- is encountered during rendering, an OS_Error pointer may be put in the
- DrawFile_DeclareFontsState structure, but this should only be done if the
- pointer currently there is 0. The DrawFile module will attempt to declare
- fonts for all objects, but only return the first error found. The block is
- defined as
-
- +0 -> object to be rendered
- +4 -> diagram
- +8 -> font table object, or 0 if none found yet
- +12 = flags, as passed to DrawFile_DeclareFonts
- +16 -> error block, or 0
-
- *Commands
- ---------
- There is one *command, *Render, with syntax
-
- Render [-file] <filename> [<m00> <m01> <m10> <m11> <m20> <m21>]
- [-bbox] [-suppress] [-flatness <flatness>]
-
- It renders the given drawfile through the transformation specified. If -bbox
- is specified, bounding boxes are drawn as well. If -suppress is given, the
- objects themselves are not displayed, although the file is checked for
- consistency and bounding boxes (if requested) are. If a flatness argument is
- given (preceded by the keyword -flatness), this is passed to the draw
- module.
-
- All units for the *command are the natural ones. Decimal fractions may be
- specified if required, but negative numbers must be quoted because of
- limitations in OS_ReadArgs. The scaling is:
-
- m00 m01 m10 m11: 0x10000
- m20 m21: 256
- flatness 256
-
- For example, to render a draw file F at 1.5 times zoom, with a flatness of
- 0.5 O S units (128 draw units), the command is
-
- Render F 1.5 0 0 1.5 0 0 -flatness .5
-
- Other information
- ---- ------------
-
- The SWI chunk number of the DrawFile module is 0x45540 and its error base
- is 0x20C00. It has no vectors, upcalls or events.
-
- The errors it provides are
-
- Error_DrawFileNotDraw (0x20C00) The file is not a Draw file (as recognised
- by the first 4 characters 'D', 'r', 'a', 'w').
- Error_DrawFileVersion (0x20C01) The file specifies a format version number
- which is not understood.
- Error_DrawFileFontTab (0x20C02) The file contains more than one font
- table.
- Error_DrawFileBadFontNo (0x20C03) A text line (or transformed text line)
- uses a font that is not in the font table object.
- Error_DrawFileBadMode (0x20C04) The file contains a sprite defined in a
- mode which is not recognised.
- Error_DrawFileBadFile (0x20C05) The size of an object in the file is
- larger than the size of the file allows.
- Error_DrawFileBadGroup (0x20C06) The size of an object in a group is
- greater than the size of the group allows.
- Error_DrawFileBadTag (0x20C07) The size of a tagged object's data is
- larger than the size of the tagged object allows.
- Error_DrawFileSyntax (0x20C08) A text area has an illegal or unrecognised
- command sequence in it.
- Error_DrawFileFontNo (0x20C09) An attempt was made to set a font (with a
- \<digit> command) which had no definition (\F command).
- Error_DrawFileAreaVer (0x20C0A) The text area version command (\!) has
- specified a version which is not understood.
- Error_DrawFileNoAreaVer (0x20C0B) There is a text area with no version
- (\!) command.
-
- Notes
- =====
-
- There are some small differences between the output of the DrawFile
- module and Draw, as enumerated below:
-
- Text
- ----
-
- A text line that uses a font which can't be found will be rendered (in
- system font) at a size to fit its bounding bound.
-
- Transformed text
- ----------- ----
-
- Transformed text lines in system font are supported. A transformed text
- line that uses a font which can't be found will be rendered (in system font)
- at a size to fit its bounding bound. The transformation will be ignored.
-
- Text areas
- ---- -----
-
- In a text area, if you change (for example) the margin size (\M command),
- the change doesn't take effect until the next output line. In Draw, this
- refers to printable characters: but in DrawFile, it includes colour and font
- change commands as well. (This is because DrawFile uses the Font Manager to
- remember the current font and colours.) This means that line breaks can
- happen at slightly different places when using DrawFile.
-
- The following commands cause output to occur: B C U V <digits>. The
- following do not: ! ; A D F L M P. By preceding the former with the latter,
- the problem can be avoided.
-
- Sprite colours
- ------ -------
-
- For a sprite without a palette, the colours used are the WIMP colours,
- found by using Wimp_ReadPalette. This would lead to inconsistent behaviour
- if the WIMP was not running on the machine.